package com.taldh.design.patterns.singleton;

import org.junit.Assert;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * date 2020/6/21
 *
 * @author 袁小黑
 * @version 1.0.0
 **/

public class ReflectInvokeSingleton {

    public static void main(String[] args) {
        try {
            LazyLoadedInvoryTower instance = LazyLoadedInvoryTower.getInstance();
            Constructor<LazyLoadedInvoryTower> constructor = LazyLoadedInvoryTower.class.getDeclaredConstructor();
            constructor.setAccessible(true);
            LazyLoadedInvoryTower lazyLoadedInvoryTower = constructor.newInstance();

            System.out.println("lazyLoadedInvoryTower = " + lazyLoadedInvoryTower);
            System.out.println("instance = " + instance);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
